---
title: oras attach
sidebar_position: 10
warning: Do NOT modify this generated file
---

# oras attach

[Preview] Attach files to an existing artifact
** This command is in preview and under development. **

```bash
oras attach [flags] --artifact-type=<type> <name>{:<tag>|@<digest>} <file>[:<type>] [...]
```

## Examples

Attach file 'hi.txt' with type 'doc/example' to manifest 'hello:v1' in registry 'localhost:5000':

```bash
oras attach --artifact-type doc/example localhost:5000/hello:v1 hi.txt
```

Attach file "hi.txt" using a specific method for the Referrers API:

```bash
oras attach --artifact-type doc/example --distribution-spec v1.1-referrers-api localhost:5000/hello:v1 hi.txt # via API
oras attach --artifact-type doc/example --distribution-spec v1.1-referrers-tag localhost:5000/hello:v1 hi.txt # via tag scheme
```

Attach file 'hi.txt' and add annotations from file 'annotation.json':

```bash
oras attach --artifact-type doc/example --annotation-file annotation.json localhost:5000/hello:v1 hi.txt
```

Attach an artifact with manifest annotations:

```bash
oras attach --artifact-type doc/example --annotation "key1=val1" --annotation "key2=val2" localhost:5000/hello:v1
```

Attach file 'hi.txt' and add manifest annotations:

```bash
oras attach --artifact-type doc/example --annotation "key=val" localhost:5000/hello:v1 hi.txt
```

Attach file 'hi.txt' and export the pushed manifest to 'manifest.json':

```bash
oras attach --artifact-type doc/example --export-manifest manifest.json localhost:5000/hello:v1 hi.txt
```

Attach file to the manifest tagged 'v1' in an OCI image layout folder 'layout-dir':

```bash
oras attach --oci-layout --artifact-type doc/example layout-dir:v1 hi.txt
```

## Options

```
  -a, --annotation stringArray                     manifest annotations
      --annotation-file string                     path of the annotation file
      --artifact-type string                       artifact type
      --ca-file string                             server certificate authority file for the remote registry
      --concurrency int                            concurrency level (default 5)
  -d, --debug                                      debug mode
      --disable-path-validation                    skip path validation
      --distribution-spec string                   [Preview] set OCI distribution spec version and API option for target. options: v1.1-referrers-api, v1.1-referrers-tag
      --export-manifest path                       path of the pushed manifest
  -H, --header stringArray                         add custom headers to requests
  -h, --help                                       help for attach
      --insecure                                   allow connections to SSL registry without certs
      --oci-layout                                 set target as an OCI image layout
  -p, --password string                            registry password or identity token
      --password-stdin                             read password or identity token from stdin
      --plain-http                                 allow insecure connections to registry without SSL check
      --registry-config path                       path of the authentication file for registry
      --resolve host:port:address[:address_port]   customized DNS for registry, formatted in host:port:address[:address_port]
  -u, --username string                            registry username
  -v, --verbose                                    verbose output
```
